From efd8ff0a04740a698b2b8b2b9adccd639e0fa6c9 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Mon, 20 Jan 2014 09:48:11 +0100 Subject: [PATCH] common/sysctl: Don't leak status in SYSCTL_page_offline_op In addition, 'copyback' should be cleared even in the error case. Also fix the indentation of the arguments to copy_to_guest() to help clarify that the 'ret = -EFAULT' is not part of the condition. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Keir Fraser --- xen/common/sysctl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 117e095a35..0cb6ee15fb 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -230,12 +230,9 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) } if ( copy_to_guest( - op->u.page_offline.status, status, - op->u.page_offline.end - op->u.page_offline.start + 1) ) - { + op->u.page_offline.status, status, + op->u.page_offline.end - op->u.page_offline.start + 1) ) ret = -EFAULT; - break; - } xfree(status); copyback = 0; -- 2.30.2